Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the following array declaration in &... Start Learning for Free
Consider the following array declaration in ‘C’ language:
int array[] = {2, 3, 4, 5};
What will be the output of the following statement?
printf("%d", 2[array]);
  • a)
    4
  • b)
    3
  • c)
    2
  • d)
    5
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
Consider the following array declaration in ‘C’ language:i...
An array is defined as the collection of similar types of data items stored at contiguous memory locations. Arrays are the derived data type in C programming language which can store the primitive type of data such as int, char, double, float, etc. C array is beneficial if you have to store similar elements.
int array[] = {2, 3, 4, 5}; This array storage be like, 
The above array at index I can be accessed by, a[i], i[a], *(a+i) or *(i+a) all the above representations all are equal and gives the i th index value.
printf(%d', 2[array]); So, it gives the 2nd  index value. i.e 4.
Hence the correct answer is 4.
Free Test
Community Answer
Consider the following array declaration in ‘C’ language:i...

Explanation:

Accessing array elements:
- In C language, array elements can be accessed using the index of the element within square brackets.
- The first element of an array has an index of 0, the second element has an index of 1, and so on.

Given array declaration:
- int array[] = {2, 3, 4, 5};
- The array 'array' contains elements {2, 3, 4, 5}.

Understanding the statement:
- In the statement printf("%d", 2[array]);, 2[array] is equivalent to array[2].
- array[2] means accessing the element at index 2 in the array 'array'.

Output:
- The element at index 2 in the array 'array' is 4.
- Therefore, the output of the statement printf("%d", 2[array]); will be 4.

Therefore, the correct option is option 'A' which is 4.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer?
Question Description
Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer?.
Solutions for Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer?, a detailed solution for Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following array declaration in ‘C’ language:int array[] = {2, 3, 4, 5};What will be the output of the following statement?printf("%d", 2[array]);a)4b)3c)2d)5Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev